package com.array;

import java.util.List;

/**
 * @Author: tgy
 * @Date: 2020-08-25 09:54
 */
public class Test01 {

    public static void main(String[] args) {


//        test01();


        ArrayList<Person> personArrayList = new ArrayList<>();


        for (int i = 0; i < 50; i++) {

            personArrayList.add(new Person("zhangli" + i, i));
        }

        personArrayList.remove(10);

        System.gc();

//        personArrayList.add(3,new Person("lisi",21));

        System.out.println(personArrayList.indexof(new Person("zhangli26", 26)));

        System.out.println(personArrayList);

    }

    private static void test01() {
        java.util.ArrayList<Integer> con = new java.util.ArrayList<Integer>();

        con.add(1);
        con.add(1);
        con.set(0,2);
        con.add(2,4);
        System.out.println(con);
//        con.set(1,1);

        ArrayList<Integer> arrayList = new ArrayList<>();

        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        arrayList.add(4);
        arrayList.add(5);

        System.out.println(arrayList);

        arrayList.add(3,10);
        System.out.println(arrayList);

        arrayList.remove(2);
        System.out.println(arrayList);

        System.out.println(arrayList.indexof(3));

        arrayList.set(1,11);

        System.out.println(arrayList);


        for (int i = 0; i < 1000 ; i++) {

            arrayList.add(i);
        }

        System.out.println(arrayList);
    }
}
